import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
    {
        path: '/',
        component: () => import('../layouts/Mainlayout.vue'),
        redirect: '/login',
        children: [
            { path: 'index', name: 'index', component: () => import('../views/VideoPage.vue') },
            { path: 'ai', name: 'ai', component: () => import('../views/AichatPage.vue') },
            { path: 'contest', name: 'contest', component: () => import('../views/ContestPage.vue') },
            { path: 'do', name: 'do', component: () => import('../views/DoContest.vue') },
            { path: 'person', name: 'person', component: () => import('../views/PersonPage.vue') },
            { path: 'contest_detail', name: 'contest_detail', component: () => import('../views/ContestView.vue') },
        ]
    },
    {
        path: '/watch',
        name: 'watch',
        component: () => import('../views/VideoplayPage.vue')
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('../views/LoginPage.vue')
    }
]

const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes, // `routes: routes` 的缩写
})

export { router, routes }